package rc4

import (
	"crypto/rc4"
)

func Encrypt(plainText []byte, key []byte) []byte {
	crypted := make([]byte, len(plainText))
	cipher, err := rc4.NewCipher(key)
	if err != nil {
		panic("")
	}
	cipher.XORKeyStream(crypted, plainText)
	return crypted
}

func Decrypt(cipherText []byte, key []byte) []byte {
	plainText := make([]byte, len(cipherText))
	cipher, err := rc4.NewCipher(key)
	if err != nil {
		panic("")
	}
	cipher.XORKeyStream(plainText, cipherText)
	return plainText
}
